<template>
  <div>
    <el-page-header @back="goBack" content="任务详情"/>
    <TaskDetail :style="{height: CONST.WORKSPACE_HEIGHT - 35 + 'px'}" :task="task" @current-change="handleCurrentChange" @size-change="handleSizeChange"/>
  </div>
</template>

<script>
import TaskDetail from "./TaskDetail";

export default {
  name: "TaskDetailWrapper",
  components: {TaskDetail},
  data() {
    return {
      task: {
        basicInfo: {
          name: "",
          selfAdd: true,
          system: "",
          libName: "",
          dateRange: ["", ""],
          reviewLevel: 0,
          fileList: [],
          comment: ""
        },
        subTask: [],
        subTaskTotal: 0,
        subTaskSize: 10,
        subTaskPage: 0,
      },
      subTasks: [],
      id: "",
      size: 10,
      page: 0
    }
  },
  methods: {
    getTask() {
      this.axios.get("/pmph/action/task/selectTask4TaskDetail", {
        params: {
          id: this.id,
          size: this.size,
          page: this.page
        }
      }).then((response) => {
        if (response.data) {
          this.task = response.data
        }
      })
    },
    goBack() {
      this.$router.go(-1);
    },
    handleCurrentChange(val) {
      this.page = val - 1
      this.getTask()
    },
    handleSizeChange(val) {
      this.size = val
      this.getTask()
    }
  },
  created() {
    if (this.$route.query.id && this.$route.query.id.length > 0) {
      this.id = this.$route.query.id
    }
    this.getTask()
  }
}
</script>

<style scoped>

</style>
